package factory.factorymethod;

/**
 * @ProjectName: interview
 * @Package: factory.absfactory
 * @ClassName: AbsFactory
 * @Author: chenmengqi
 * @Description: null
 * @Date: 2020/2/13 9:25 下午
 * @Version: 1.0
 */
//一个抽象工厂模式的抽象层(接口)
public interface AbsFactory {
    //让下面的工厂子类来 具体实现
    public Operation createOperation();
}

class AddFactory implements AbsFactory {
    @Override
    public Operation createOperation() {
        return new OperateAdd();
    }
}

class SubFactory implements AbsFactory {
    @Override
    public Operation createOperation() {
        return new OperateSub();
    }
}

class MulFactory implements AbsFactory {
    @Override
    public Operation createOperation() {
        return new OperateMul();
    }
}

class DivFactory implements AbsFactory {
    @Override
    public Operation createOperation() {
        return new OperateDiv();
    }
}

